<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background: skyblue;
            position: absolute;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
        var box = document.getElementsByClassName("box")[0];
        box.onclick = function(){
            var num = 0;
            var timer = setInterval(function(){
                num++;
                box.style.left=`${num}px`;
            },10)
            var timer2;
            var time3;
            setTimeout(function() {
                clearInterval(timer);
                var num2 = 0;
                 timer2 = setInterval(function(){
                    num2++;
                    box.style.top=`${num2}px`;
                    // return timer2;
                },10)
            }, 2000);
            setTimeout(function() {
                // var timer2 = timer2;
                clearInterval(timer2);
                // var num3 = 0;
                 var num3 = parseInt(box.style.left);
                 timer3 = setInterval(function(){
                    // num3++;
                    num3--
                    box.style.left=`${num3}px`;
                },10)
             },4000);
             setTimeout(function() {
                // var timer2 = timer2;
                clearInterval(timer3);
                // var num3 = 0;
                 var num4 = parseInt(box.style.top);
                 timer3 = setInterval(function(){
                    // num3++;
                    num4--
                    box.style.top=`${num4}px`;
                },10)
             },6000);
        }
    </script>
</body>
</html>